<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"  
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:f="http://java.sun.com/jsf/core" 
      xmlns:h="http://java.sun.com/jsf/html">
   <h:head>
      <title>#{msgs.windowTitle}</title>
   </h:head>
   <h:outputStylesheet library="css" name="bootstrap.css"  />
   <h:body style="padding-left:10px">
   		<h:form>
   			<h:panelGrid columns="9" cellpadding="7" width="675">
   				<h:outputText value="#{msgs.eNum}" style="font-weight: bold"/>#{tableData.eNum}
   				<h:outputText value="#{msgs.week}" style="font-weight: bold"/>#{tableData.selectedWeek}
   				<h:outputText value="#{msgs.weekE}" style="font-weight: bold"/>#{tableData.weekEnd}
   				<h:outputText value="#{msgs.name}" style="font-weight: bold"/> #{tableData.name}
   				<h:commandButton value="Logout" class="btn btn-small btn-warning"
                          action="#{tableData.logout}"/>
   			</h:panelGrid>
   			<h:outputText value="Change Week To:" style="font-weight: bold"/>
   			<h:selectOneMenu style="vertical-align: top;padding-bottom: 1px;width: 55px" value="#{tableData.weekValue}">
   				<f:selectItems value="#{tableData.weeks}"/>
   			</h:selectOneMenu>
   			<h:commandButton value="Change" class="btn btn-small btn-primary"
                          action="#{tableData.changeWeek}"/>
   		</h:form>
      	<h:form>
         <h:dataTable value="#{tableData.names}" var="name" frame="border" rules="all" width="671px"
         		styleClass="order-table" headerClass="order-table-header" 
         		rowClasses="order-table-odd-row,order-table-even-row" >
            <h:column style="text-align:center" rendered = "#{tableData.isCurrentWeek}">
               <f:facet name="header">
                  <h:outputText value="#{msgs.editColumn}" 
                                style="font-weight: bold"/>
               </f:facet>
               <h:selectBooleanCheckbox value="#{name.editable}" onclick="submit()"/>
            </h:column>
            <h:column style="text-align:left">
               <f:facet name="header">
                  <h:outputText value="#{msgs.project}" 
                                style="font-weight: bold"/>
               </f:facet>
               <h:inputText value="#{name.project}" rendered="#{name.editable}" 
                            size="5" style="width: 40px"/>
               <h:outputText value="#{name.project}" rendered="#{not name.editable}"/>
               <f:facet name="footer">
                  <h:outputText value="Total:" 
                                style="font-weight: bold"/>
               </f:facet>
            </h:column>
            <h:column style="text-align:left">
               <f:facet name="header">
                  <h:outputText value="#{msgs.wp}"
                                style="font-weight: bold"/>
               </f:facet>
               <h:inputText value="#{name.wp}" rendered="#{name.editable}" 
                            size="5" style="width: 40px"/>
               <h:outputText value="#{name.wp}" rendered="#{not name.editable}"/>
            </h:column>
            <h:column style="text-align:right">
               <f:facet name="header">
                  <h:outputText value="#{msgs.total}" 
                                style="font-weight: bold"/>
               </f:facet>
               <h:inputText value="#{name.total}" rendered="#{name.editable}" 
                            size="5" style="width: 25px"/>
               <h:outputText value="#{name.total}" rendered="#{not name.editable}"/>
               <f:facet name="footer">
                  <h:outputText value="#{tableData.ttotal}"
                                style="font-weight: bold"/>
               </f:facet>
            </h:column>
            <h:column style="text-align:right">
               <f:facet name="header">
                  <h:outputText value="#{msgs.sat}" 
                                style="font-weight: bold"/>
               </f:facet>
               <h:inputText value="#{name.sat}" rendered="#{name.editable}" 
                            size="5" style="width: 25px"/>
               <h:outputText value="#{name.sat}" rendered="#{not name.editable}"/>
               <f:facet name="footer">
                  <h:outputText value="#{tableData.tsat}"
                                style="font-weight: bold"/>
               </f:facet>
            </h:column>
            <h:column style="text-align:right">
               <f:facet name="header">
                  <h:outputText value="#{msgs.sun}" 
                                style="font-weight: bold"/>
               </f:facet>
               <h:inputText value="#{name.sun}" rendered="#{name.editable}" 
                            size="5" style="width: 25px"/>
               <h:outputText value="#{name.sun}" rendered="#{not name.editable}"/>
               <f:facet name="footer">
                  <h:outputText value="#{tableData.tsun}"
                                style="font-weight: bold"/>
               </f:facet>
            </h:column>
            <h:column style="text-align:right">
               <f:facet name="header">
                  <h:outputText value="#{msgs.mon}" 
                                style="font-weight: bold"/>
               </f:facet>
               <h:inputText value="#{name.mon}" rendered="#{name.editable}" 
                            size="5" style="width: 25px"/>
               <h:outputText value="#{name.mon}" rendered="#{not name.editable}"/>
               <f:facet name="footer">
                  <h:outputText value="#{tableData.tmon}"
                                style="font-weight: bold"/>
               </f:facet>
            </h:column>
            <h:column style="text-align:right">
               <f:facet name="header">
                  <h:outputText value="#{msgs.tue}" 
                                style="font-weight: bold"/>
               </f:facet>
               <h:inputText value="#{name.tue}" rendered="#{name.editable}" 
                            size="5" style="width: 25px"/>
               <h:outputText value="#{name.tue}" rendered="#{not name.editable}"/>
               <f:facet name="footer">
                  <h:outputText value="#{tableData.ttue}"
                                style="font-weight: bold"/>
               </f:facet>
            </h:column>
            <h:column style="text-align:right">
               <f:facet name="header">
                  <h:outputText value="#{msgs.wed}" 
                                style="font-weight: bold"/>
               </f:facet>
               <h:inputText value="#{name.wed}" rendered="#{name.editable}" 
                            size="5" style="width: 25px"/>
               <h:outputText value="#{name.wed}" rendered="#{not name.editable}"/>
               <f:facet name="footer">
                  <h:outputText value="#{tableData.twed}"
                                style="font-weight: bold"/>
               </f:facet>
            </h:column>
            <h:column style="text-align:right">
               <f:facet name="header">
                  <h:outputText value="#{msgs.thu}"
                                style="font-weight: bold"/>
               </f:facet>
               <h:inputText value="#{name.thu}" rendered="#{name.editable}" 
                            size="5" style="width: 25px"/>
               <h:outputText value="#{name.thu}" rendered="#{not name.editable}"/>
               <f:facet name="footer">
                  <h:outputText value="#{tableData.tthu}"
                                style="font-weight: bold"/>
               </f:facet>
            </h:column>
            <h:column style="text-align:right">
               <f:facet name="header">
                  <h:outputText value="#{msgs.fri}"
                                style="font-weight: bold"/>
               </f:facet>
               <h:inputText value="#{name.fri}" rendered="#{name.editable}" 
                            size="5" style="width: 25px"/>
               <h:outputText value="#{name.fri}" rendered="#{not name.editable}"/>
               <f:facet name="footer">
                  <h:outputText value="#{tableData.tfri}"
                                style="font-weight: bold"/>
               </f:facet>
            </h:column>
            <h:column style="text-align:left">
               <f:facet name="header">
                  <h:outputText value="#{msgs.note}" 
                                style="font-weight: bold"/>
               </f:facet>
               <h:inputText value="#{name.notes}" rendered="#{name.editable}" 
                            size="20" style="width: 115px"/>
               <h:outputText value="#{name.notes}" rendered="#{not name.editable}"/>
            </h:column>
            <h:column style="text-align:center" rendered = "#{tableData.isCurrentWeek}">
               <f:facet name="header">
                  <h:outputText value="#{msgs.delete}"
                                style="font-weight: bold"/>
               </f:facet>
               <h:commandButton value="#{msgs.delete}" class="btn btn-small btn-danger"
                          action="#{tableData.delete(name)}"/>
            </h:column>
         </h:dataTable>
         <br />
         <div class="btn-group">
         	<h:commandButton rendered = "#{tableData.isCurrentWeek}" value="#{msgs.add}" class="btn btn-small btn-success"
                          action="#{tableData.add}"/>
         	<h:commandButton rendered = "#{tableData.isCurrentWeek}" value="#{msgs.saveChangesButtonText}" class="btn btn-small btn-primary"
                          action="#{tableData.save}"/>
         </div>
      </h:form>
   </h:body>
</html>
